
<template>
    <div class="page-box h100 display-flex czbj">
        <div>
            <dxtable :dataJson="dataJson" :formJson="formJson" :portUrl="portUrl" :qx="qx" ref="databale" :showdr="true"
                :headBtn="headBtnw"></dxtable>
        </div>


    </div>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf, downImg } from "../../util/index";
import { h, ref, reactive } from "vue";
const props = defineProps({
    pup: { type: String },
});
const showModal = ref()
const videourl = ref()
const zdList = ref()
const databale = ref();
const initeer = () => {
    databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
const headBtnw = ref([
    {
        name: "下载模版",
        jy: true,
        type: "default",
        clickFun: () => {
            window.location.href =
                "https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/excleTojpg/%E6%A8%A1%E7%89%88%E6%96%87%E4%BB%B6.xlsx";

        },
    },
]);


// 弹窗公用该列表
let dataJson = reactive([
    {
        title: "參考編碼",
        key: "sdfdsb",
    }, {
        title: "報告編碼",
        key: "sdfdsd",
    }, {
        title: "受測者",
        key: "sdfdsc",
    }, {
        title: "報告日期",
        key: "sdfdsl",
    }, {
        title: "葉酸的整體代謝能力",
        key: "dfsfsa",
        render(row) {
            return h('span', { class: row.dfsfsa == '弱' ? 'dls' : 'dred' }, row.dfsfsa)
        }
    }, {
        title: "葉酸的需求量",
        key: "dfsfsb",
        render(row) {
            return h('span', { class: row.dfsfsb == '弱' ? 'dls' : 'dred' }, row.dfsfsb)
        }
    }, {
        title: "是次'胎兒神經管畸形風險評估'的結果",
        key: "dfsfsc",
        render(row) {
            return h('span', { class: row.dfsfsc.indexOf('正常') >= 0 ? 'dls' : 'dred' }, row.dfsfsc)
        }
    },
    {
        title: "Y染色體篩",
        key: "dfsfsd",
        render(row) {
            return h('span', { class: row.dfsfsd == '陰性' ? 'dls' : 'dred' }, row.dfsfsd)
        }
    },
    {
        title: "葉酸",
        key: "",
        render(row) {
            return h('span', {
                class: "ls sz", onClick: async () => {
                    databale.value.tableload(true)
                  
                        let { data }: any = await dxget("https://duxinggj.com/excleTojpg/api/exportjpg", {
                            url: "https://duxinggj.com/excleTojpg/index?id=" + row.id,
                            pageWidth: 900
                        })
                        downImg(data,row.sdfdsb+'-'+ row.sdfdsc + '-葉酸需求量基因檢測報告-' + row.sdfdsd)
                        await dxpost(portUrl, { id: row.id, imga: data }, 'put')
                        initeer();
               
                        let dsfsetr = await dxget("https://duxinggj.com/excleTojpg/api/urlzpdf", {
                            url: "https://duxinggj.com/excleTojpg/index?id=" + row.id
                        })
                        downImg(dsfsetr.data, row.sdfdsb+'-'+ row.sdfdsc + '-葉酸需求量基因檢測報告-' + row.sdfdsd, ".pdf")
                        await dxpost(portUrl, { id: row.id, padfa: dsfsetr.data }, 'put')
                        initeer();
                



                    databale.value.tableload(false)
                }
            }, '下载报告')
        }
    }, {
        title: "胎儿",
        key: "",
        render(row) {
            return h('span', {
                class: "ls sz", onClick: async () => {
                    databale.value.tableload(true)
                 
                        let { data }: any = await dxget("https://duxinggj.com/excleTojpg/api/exportjpg", {
                            url: "https://duxinggj.com/excleTojpg/bger?id=" + row.id,
                            pageWidth: 900
                        })
                        downImg(data, row.sdfdsb+'-'+row.sdfdsc + '-胎兒神經管畸形風險報告-' + row.sdfdsd)
                        await dxpost(portUrl, { id: row.id, imgb: data }, 'put')
                        initeer();
               


               
                        let dsfsetr = await dxget("https://duxinggj.com/excleTojpg/api/urlzpdf", {
                            url: "https://duxinggj.com/excleTojpg/bger?id=" + row.id
                        })
                        downImg(dsfsetr.data, row.sdfdsb+'-'+row.sdfdsc + '-胎兒神經管畸形風險報告-' + row.sdfdsd, ".pdf")
                        await dxpost(portUrl, { id: row.id, padfb: dsfsetr.data }, 'put')
                        initeer();
                    databale.value.tableload(false)
                }
            }, '下载报告')
        }
    }, {
        title: "母血染色體",
        key: "",
        render(row) {
            return h('span', {
                class: "ls sz", onClick: async () => {
                    databale.value.tableload(true)
                        let { data }: any = await dxget("https://duxinggj.com/excleTojpg/api/exportjpg", {
                            url: "https://duxinggj.com/excleTojpg/bgsan?id=" + row.id,
                            pageWidth: 900
                        })
                        downImg(data, row.sdfdsb+'-'+row.sdfdsc + '-母血染色體檢測報告-' + row.sdfdsd)
                        await dxpost(portUrl, { id: row.id, imgc: data }, 'put')
                        initeer();
                   

            
                        let dsfsetr = await dxget("https://duxinggj.com/excleTojpg/api/urlzpdf", {
                            url: "https://duxinggj.com/excleTojpg/bgsan?id=" + row.id
                        })
                        downImg(dsfsetr.data, row.sdfdsb+'-'+row.sdfdsc + '-母血染色體檢測報告-' + row.sdfdsd, ".pdf")
                        await dxpost(portUrl, { id: row.id, padfc: dsfsetr.data }, 'put')
                        initeer();
             


                    databale.value.tableload(false)
                }
            }, '下载报告')
        }
    },
    // {
    //     title: "排序",
    //     width: 100,
    //     render(row) {
    //         row.databaseName = "excleTojpg";
    //         return h(sort, {
    //             row,
    //             onCallBack: () => {
    //                 initeer();
    //             },
    //         });
    //     },
    // },
    {
        title: "添加时间",
        key: "addTime",
        width: "140",
        type: "daterange",
    },
]);
let portUrl = "excleTojpg/excleTojpg";
const qx = {
    DeletePermissionID: "excleTojpgindexdel", //删除
    EditPermissionIdentifier: "excleTojpgindexbj", // 编辑
    NewPermissionIdentifier: "excleTojpgindexxz", // 新建
    ViewPermissionID: "excleTojpgindexck", // 查看
};

let formJson = reactive([

 {
        title: "轉介診所",
        key: "sdfdsa",
        type: "input",
    }, {
        title: "參考編號",
        key: "sdfdsb",
        type: "input",
    }, {
        title: "受測者",
        key: "sdfdsc",
        type: "input",
    }, {
        title: "報告編號",
        key: "sdfdsd",
        type: "input",
    }, {
        title: "出生日期",
        key: "sdfdse",
        type: "input",
    }, {
        title: "樣本類別",
        key: "sdfdsf",
        type: "input",
    }, {
        title: "種族起源",
        key: "sdfdsg",
        type: "input",
    }, {
        title: "採樣日期",
        key: "sdfdsh",
        type: "input",
    }, {
        title: "證件編號",
        key: "sdfdsi",
        type: "input",
    }, {
        title: "交收日期",
        key: "sdfdsj",
        type: "input",
    }, {
        title: "妊娠週數",
        key: "sdfdsk",
        type: "input",
    }, {
        title: "報告日期",
        key: "sdfdsl",
        type: "input",
    }, {
        title: "葉酸的整體代謝能力",
        key: "dfsfsa",
        type: "input",
    }, {
        title: "葉酸的需求量",
        key: "dfsfsb",
        type: "input",
    }, {
        title: "胎兒神經管畸形風險評估",
        key: "dfsfsc",
        type: "input",
    }, {
        title: "Y染色體篩",
        key: "dfsfsd",
        type: "input",
    }, {
        title: "母血染色體報告日期",
        key: "dfsfse",
        type: "input",
    }




])


</script>
  
  
  